<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="学号" prop="studentNo">
        <el-input
          v-model="queryParams.studentNo"
          placeholder="请输入学号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学生姓名" prop="studentName">
        <el-input
          v-model="queryParams.studentName"
          placeholder="请输入学生姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号" prop="cellNo">
        <el-input
          v-model="queryParams.cellNo"
          placeholder="请输入手机号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <div v-if="highQueryFlag">
        <el-form-item label="校区" prop="campusId">
          <treeselect style="width:200px" v-model="queryParams.campusId" :options="campusOptions" 
                :multiple="false" :disableBranchNodes="true"
                :select="selectOthers"
                :show-count="true" placeholder="请选择归属校区" />
        </el-form-item>

      <el-form-item label="学校" prop="schoolId">
        <el-select
              v-model="queryParams.schoolId"
              placeholder="请选择学校"
              clearable
              size="small"
              style="width: 200px"
            >
              <el-option
                v-for="school in schoolOptions"
                :key="school.schoolId"
                :label="school.schoolName"
                :value="school.schoolId"
              />
            </el-select>
      </el-form-item>
      
      <el-form-item label="班级" prop="classId">
        <el-select
              v-model="queryParams.classId"
              placeholder="请选班级"
              clearable
              size="small"
              style="width: 200px"
            >
              <el-option
                v-for="classInfo in classOptions"
                :key="classInfo.classId"
                :label="classInfo.className"
                :value="classInfo.classId"
              />
            </el-select>
      </el-form-item>
      <el-form-item label="年级" prop="grade">
        <el-input
          v-model="queryParams.grade"
          placeholder="请输入年级"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="科别" prop="subjectType">
        <el-select v-model="queryParams.subjectType" placeholder="请选择科别" clearable size="small">
          <el-option
                  v-for="dict in subjectTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
        </el-select>
      </el-form-item>
      <!--
      <el-form-item label="营销来源" prop="marketingSource">
        <el-input
          v-model="queryParams.marketingSource"
          placeholder="请输入营销来源"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      -->
      <el-form-item label="招生员" prop="recruitUserId">
        <el-select
              v-model="queryParams.recruitUserId"
              placeholder="请选招生员"
              clearable
              size="small"
              style="width: 200px"
            >
              <el-option
                v-for="user in recruitUserOptions"
                :key="user.userId"
                :label="user.nickName"
                :value="user.userId"
              />
            </el-select>
      </el-form-item>
      <el-form-item label="缴费类型" prop="payType">
        <el-select v-model="queryParams.payType" placeholder="请选择缴费类型" clearable size="small">
          <el-option
                v-for="dict in payTypeOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
        </el-select>
      </el-form-item>
      <el-form-item label="缴费状态" prop="payStatus">
        <el-select v-model="queryParams.payStatus" placeholder="请选择缴费状态" clearable size="small">
          <el-option
                v-for="dict in payStatusOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
        </el-select>
      </el-form-item>
      <el-form-item label="学员状态" prop="studentType">
        <el-select v-model="queryParams.studentType" placeholder="请选择学员状态" clearable size="small">
          <el-option
                v-for="dict in studentTypeOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
        </el-select>
      </el-form-item>
      <!--
      <el-form-item label="学习状态" prop="trainType">
        <el-select v-model="queryParams.trainType" placeholder="请选择学习状态" clearable size="small">
          <el-option
                v-for="dict in trainTypeOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
        </el-select>
      </el-form-item>
      
      <el-form-item label="帐号状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择帐号状态" clearable size="small">
          <el-option
                v-for="dict in statusOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
        </el-select>
      </el-form-item>
      -->
      </div>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <el-button :icon="highQueryIcon" size="mini" @click="highQuery">高级查询</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleAdd"
          v-hasPermi="['edu:student:add']"
        >审核</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['edu:student:edit']"
        >回款确认</el-button>
      </el-col>

	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column v-if="false" label="学生ID" align="center" prop="studentId" />
      <el-table-column label="学生姓名" align="center" prop="studentName" width="100px" />
      <el-table-column label="学校" align="center" prop="schoolName" width="150px" />
      <el-table-column label="校区" align="center" prop="schoolName" width="150px" />
      <el-table-column label="身份证号" align="center" prop="idNo"/>
      <el-table-column label="手机号" align="center" prop="cellNo" width="120px" />
      <el-table-column label="学员状态" :formatter="studentTypeFormat" align="center" prop="studentType" width="100px" />
      <el-table-column label="缴费类型" :formatter="payTypeFormat" align="center" prop="payType" width="100px" />
      <el-table-column label="缴费状态" :formatter="payStatusFormat" align="center" prop="payStatus" width="100px" />
      <el-table-column label="招生员" align="center" prop="recruitUserName" width="100px" />
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog :title="title" :visible.sync="openExamine" width="800px" append-to-body>
      <el-form ref="examineForm" :model="examineForm" label-width="120px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="审核状态" prop="examineStatus">
              <el-select
                    v-model="examineForm.examineStatus"
                    placeholder="请选审核状态"
                    clearable
                    size="small"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="info in examineOptions"
                      :key="info.value"
                      :label="info.label"
                      :value="info.value"
                    />
                  </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="缴费类型" prop="payType">
              <el-select v-model="examineForm.payType" placeholder="请选择缴费类型">
                <el-option
                    v-for="dict in payTypeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="分期数" prop="stageNum">
              <el-input :disabled="!stageInputStatus" v-model="examineForm.stageNum" placeholder="请输入分期数" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分期金额" prop="stageAmount">
              <el-input :disabled="!stageInputStatus" v-model="examineForm.stageAmount" placeholder="请输入分期金额" />
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" @click="submitExamine">确 定</el-button>
        <el-button size="mini" @click="cancelExamine">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="title" :visible.sync="openRtnMoney" width="600px" append-to-body>
      <el-form ref="rtnMoneyForm" :model="rtnMoneyForm" label-width="120px">
        <el-row>
          <!-- <el-col :span="12">
            <el-form-item label="缴费类型" prop="payType">
              <el-select v-model="rtnMoneyForm.payType" placeholder="请选择缴费类型">
                <el-option
                    v-for="dict in payTypeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="缴费状态">
              <el-select v-model="rtnMoneyForm.payStatus" placeholder="请选择缴费状态">
                <el-option
                    v-for="dict in payStatusOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- <el-row>
          <el-col :span="12">
            <el-form-item label="分期数" prop="stageNum">
              <el-input :disabled="!stageInputStatus" v-model="rtnMoneyForm.stageNum" placeholder="请输入分期数" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分期金额" prop="stageAmount">
              <el-input :disabled="!stageInputStatus" v-model="rtnMoneyForm.stageAmount" placeholder="请输入分期金额" />
            </el-form-item>
          </el-col>
        </el-row> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" @click="submitRtnMoney">确 定</el-button>
        <el-button size="mini" @click="cancelRtnMoney">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listStudent, listExamineStudent, getStudent, stepInStudent, addStudent, updateStudent, passExamine, rtnMoney } from "@/api/edu/student";
import { listStudentStage  } from "@/api/edu/studentStage";
import { listClassStudent  } from "@/api/edu/classStudent";
import { getHSchools} from "@/api/edu/hSchools";
import { treeselectByType } from "@/api/system/dept";
import { listUserByDeptId } from "@/api/system/user";
import { listByDeptId } from "@/api/edu/hSchools";
import { getHCollegesBySchoolId } from "@/api/edu/hColleges";
import { getHMajorsByCollegeId } from "@/api/edu/hMajors";
import { ajaxList } from "@/api/edu/classInfo";
//import { listUrgentByStudentId } from "@/api/edu/urgent";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import ExtendedSelect from "@/components/ExtendedSelect";

export default {
  name: "Student",
  components: { Treeselect, ExtendedSelect },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 学生（客户）信息表格数据
      studentList: [],
      // 高级查询图标
      highQueryIcon: 'el-icon-arrow-down',
      // 高级查询标志
      highQueryFlag: false,
      activeName: 'first',
      statusOptions: [],
      // 校区数据
      campusOptions: [],
      schoolOptions: [],
      collegeOptions: [],
      majorOptions: [],
      classOptions: [],
      // 招生员
      recruitUserOptions: [],
      subjectTypeOptions: [],
      payTypeOptions: [],
      payStatusOptions: [],
      trainTypeOptions: [],
      studentTypeOptionsL: [],
      nationOptions: [],
      sexOptions: [],
      urgentInfo: [{
        urgentType: null,
        urgentName: null,
        cellNo: null,
      }],
      urgentTypeOptions: [],
      tracingInfo: [{
        userId: null,
        content: null
      }],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      openStepIn: false,
      openExamine: false,
      openRtnMoney: false,
      stepInStudentIds: null,
      stageInputStatus: true, // 分期信息输入框
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        studentNo: null,
        studentName: null,
        campusId: null,
        schoolId: null,
        collegeId: null,
        majorId: null,
        classId: null,
        grade: null,
        subjectType: null,
        studentType: null,
        idNo: null,
        nation: null,
        cellNo: null,
        qqNo: null,
        wxOpenId: null,
        email: null,
        sex: null,
        avatar: null,
        addr: null,
        urgentPerson: null,
        urgentCellNo: null,
        password: null,
        marketingSource: null,
        recruitUserId: null,
        inputUserId: null,
        auditUserId: null,
        registDate: null,
        payType: null,
        payStatus: null,
        stageNum: null,
        stageAmount: null,
        trainType: null,
        status: null,
        loginIp: null,
        loginDate: null,
      },
      campusIdForm: null,
      // 表单参数
      form: {},
      //
      examineForm: {},
      rtnMoneyForm: {},
      // 分期缴费列表
      studentStageList: [],
      totalStage: 0,
      queryParamsStage: {
        pageNum: 1,
        pageSize: 10,
        studentId: null,
      },
      // 选班列表
      classStudentList: [],
      classStatusOptions: [],
      totalCs: 0,
      queryParamsCs: {
        pageNum: 1,
        pageSize: 10,
        studentId: null,
      },
      // 表单校验
      rules: {
      },
      examineOptions: [{
          value: '0',
          label: '审核通过'
        },{
          value: '1',
          label: '拒绝通过'
        },
      ]
    };
  },
  created() {
    // 0 游客， 1 注册客户， 2 预报名， 3 学员， 00，查所有
    this.queryCampus();
    this.getDicts("sys_normal_disable").then(response => {
      this.statusOptions = response.data;
    });
    this.getDicts("edu_subject_type").then(response => {
      this.subjectTypeOptions = response.data;
    });
    this.getDicts("edu_pay_type").then(response => {
      this.payTypeOptions = response.data;
    });
    this.getDicts("edu_pay_status").then(response => {
      this.payStatusOptions = response.data;
    });
    this.getDicts("edu_train_type").then(response => {
      this.trainTypeOptions = response.data;
    });
    this.getDicts("edu_student_type").then(response => {
      this.studentTypeOptions = response.data
    })
    this.getDicts("edu_urgent_type").then(response => {
      this.urgentTypeOptions = response.data
    })
    this.getDicts("sys_nation").then(response => {
      this.nationOptions = response.data
    })
    this.getDicts("sys_user_sex").then(response => {
      this.sexOptions = response.data
    })
    this.getDicts("edu_class_status").then(response => {
      this.classStatusOptions = response.data
    })
    this.getList();
  },
  watch: {
    'queryParams.campusId': 'selectOthers',
    'campusIdForm': 'selectOthersForm',
    'form.schoolId': 'selectCollege',
    'form.collegeId': 'selectMajors',
    'form.payType': 'setStageInfo',
  },
  methods: {
    /** 查询学生（客户）信息列表 */
    getList() {
      this.loading = true;
      listExamineStudent(this.queryParams).then(response => {
        this.studentList = response.rows;
        //console.log(JSON.stringify(this.studentList))
        this.total = response.total;
        this.loading = false;
      });
    },
    queryCampus() {
      // 查询校区（deptType = 1）
      treeselectByType("1").then(response => {
        this.campusOptions = response.data;
      })
    },
    selectOthers() {
      this.queryHSchool(this.queryParams.campusId);
      this.queryRecruitUser(this.queryParams.campusId);
      this.queryClassInfo(this.queryParams.campusId);
    },
    // 新增界面
    selectOthersForm() {
      this.queryHSchool(this.campusIdForm);
      this.queryRecruitUser(this.campusIdForm);
      this.queryClassInfo(this.campusIdForm);
    },
    queryHSchool(campusId) {
      if(campusId === undefined || campusId === null) {
        this.$message({
            type: 'warning',
            message: '请选择校区'
          })
          return
      }
      
      listByDeptId(parseInt(campusId)).then(response => {
        //console.log(response.data)
        this.schoolOptions = response.data
      })
      
    },
    queryRecruitUser(campusId) {
      if(campusId === undefined || campusId === null) {
        this.$message({
            type: 'warning',
            message: '请选择校区'
          })
          return
      }
      listUserByDeptId(campusId).then(response => {
        this.recruitUserOptions = response.data
      })
    },
    queryClassInfo(campusId) {
      if(campusId === undefined || campusId === null) {
        this.$message({
            type: 'warning',
            message: '请选择校区'
          })
          return
      }
      let classInfo = {
        campusId : campusId
      }
      ajaxList(classInfo).then(response => {
        this.classOptions = response.data
      })
    },
    selectCollege() {
      if(this.form.schoolId === undefined || this.form.schoolId === null) {
        this.$message({
            type: 'warning',
            message: '请选择校区'
          })
          return
      }
      getHCollegesBySchoolId(this.form.schoolId).then(response => {
        this.collegeOptions = response.data
      })
    },
    selectMajors() {
      if(this.form.collegeId === undefined || this.form.collegeId === null) {
        this.$message({
            type: 'warning',
            message: '请选择校区'
          })
          return
      }
      getHMajorsByCollegeId(this.form.collegeId).then(response => {
        this.majorOptions = response.data
      })
    },
    // 字典状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    subjectTypeFormat(row, column) {
      return this.selectDictLabel(this.subjectTypeOptions, row.subjectType);
    },
    payTypeFormat(row, column) {
      return this.selectDictLabel(this.payTypeOptions, row.payType);
    },
    payStatusFormat(row, column) {
      return this.selectDictLabel(this.payStatusOptions, row.payStatus);
    },
    trainTypeFormat(row, column) {
      return this.selectDictLabel(this.trainTypeOptions, row.trainType);
    },
    studentTypeFormat(row, column) {
      return this.selectDictLabel(this.studentTypeOptions, row.studentType);
    },
    nationFormat(row, column) {
      return this.selectDictLabel(this.nationOptions, row.nation);
    },
    sexFormat(row, column) {
      return this.selectDictLabel(this.sexOptions, row.sex);
    },
    classStatusFormat(row, column) {
      return this.selectDictLabel(this.classStatusOptions, row.classStatus);
    },
    // 删除选择部门数据
    closeOnSelect() {
      //this.form.depts = []
      this.form.deptIds = []
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    highQuery() {
      this.highQueryFlag = !this.highQueryFlag
      if(this.highQueryIcon === 'el-icon-arrow-down' ) {
        this.highQueryIcon = 'el-icon-arrow-up'
        
      } else {
        this.highQueryIcon = 'el-icon-arrow-down'
        // 隐藏查询条件不展示
        let studentNo = this.queryParams.studentNo
        let studentName = this.queryParams.studentName
        let cellNo = this.queryParams.cellNo
        this.resetForm("queryForm");
        this.queryParams.studentNo = studentNo
        this.queryParams.studentName = studentName
        this.queryParams.cellNo = cellNo
      }
    },
    // 表单重置
    reset() {
      this.urgentInfo = [{
        urgentType: null,
        urgentName: null,
        cellNo: null,
      }],
      this.tracingInfo = [{
        userId: null,
        content: null
      }],

      this.form = {
        studentId: null,
        studentNo: null,
        studentName: null,
        schoolId: null,
        schoolName: null,
        collegeId: null,
        collegeName: null,
        majorId: null,
        majorName: null,
        classId: null,
        className: null,
        grade: null,
        subjectType: null,
        studentType: null,
        idFrontUrl: null,
        idBackUrl: null,
        idNo: null,
        nation: null,
        cellNo: null,
        qqNo: null,
        wxOpenId: null,
        email: null,
        sex: null,
        avatar: null,
        addr: null,
        urgentPerson: null,
        urgentCellNo: null,
        password: null,
        marketingSource: null,
        recruitUserId: null,
        inputUserId: null,
        auditUserId: null,
        recruitUserName: null,
        inputUserName: null,
        auditUserName: null,
        registDate: null,
        payType: null,
        payStatus: "0",
        stageNum: null,
        stageAmount: null,
        trainType: null,
        status: "0",
        delFlag: null,
        loginIp: null,
        loginDate: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        eduStudentUrgentList: null,
        eduStudentTracingList: null,
      };
      this.resetForm("form");
    },
    resetExamineForm() {
      this.examineForm = {
        examineStatus: null,
        payType: null,
        stageNum: null,
        stageAmount: null
      }
      this.resetForm("examineForm");
    },
    resetRtnMoneyForm() {
      this.rtnMoneyForm = {
        payType: null,
        payStatus: null,
        stageNum: null,
        stageAmount: null
      }
      this.resetForm("rtnMoneyForm");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.studentId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 审核按钮操作 */
    handleAdd() {
      this.resetExamineForm();
      this.openExamine = true;
      this.title = "审核学生信息";
    },
    /** 修改按钮操作 */
    handleUpdate() {
      this.resetRtnMoneyForm();
      this.openRtnMoney = true;
      this.title = "回款确认信息";
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.eduStudentUrgentList = []
          this.urgentInfo.forEach(option =>{
            this.form.eduStudentUrgentList.push({
                urgentType: option.urgentType,
                urgentName: option.urgentName,
                cellNo: option.cellNo,
              })
          })

          // tracingInfo
          this.form.eduStudentTracingList = []
          this.tracingInfo.forEach(option => {
            this.form.eduStudentTracingList.push({
              userId: option.userId,
              content: option.content
            })
          })

          if (this.form.studentId != null) {
            updateStudent(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addStudent(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    submitExamine(row) {
      const studentIds = row.studentId || this.ids;
      // const examineStatus = this.examineForm.examineStatus;
      // if (examineStatus == '1') {
      //   this.openExamine = false
      //   this.examineForm.examineStatus = null
      // } else {
      const v_examineForm = this.examineForm;
      this.$confirm('是否确认审核学生编号为"' + studentIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return passExamine(v_examineForm, studentIds);
        }).then(() => {
          this.msgSuccess("审核成功");
          this.openExamine = false;
          this.getList();
        })
      // }
    },
    cancelExamine() {
      this.openExamine = false
      this.examineForm.examineStatus = null
    },
    // 获取分期信息
    getListStage() {
      if(!this.form.studentId) {
        return
      }
      this.queryParamsStage.studentId = this.form.studentId
      this.loading = true;
      listStudentStage(this.queryParamsStage).then(response => {
        this.studentStageList = response.rows;
        this.totalStage = response.total;
        this.loading = false;
      });
    },
    setStageInfo() {
      // 设置分期信息输入框编辑状态
      if('0' === this.form.payType) {
        this.stageInputStatus = false
        this.form.stageNum = 0
        this.form.stageAmount = 0
      } else {
        this.stageInputStatus = true
      }
    },
    getClassStudentList() {
      if(!this.form.studentId) {
        return
      }
      this.queryParamsCs.studentId = this.form.studentId
      this.loading = true;
      listClassStudent(this.queryParamsCs).then(response => {
        this.classStudentList = response.rows;
        this.totalStage = response.total;
        this.loading = false;
      });
    },
    submitRtnMoney(row) {
      const studentIds = row.studentId || this.ids;
      //this.rtnMoneyForm.studentIds = studentIds;
      const v_rtnMoneyForm = this.rtnMoneyForm;
      this.$confirm('是否确认审核学生编号为"' + studentIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          console.log(JSON.stringify(v_rtnMoneyForm))
          return rtnMoney(v_rtnMoneyForm, studentIds);
        }).then(() => {
          this.msgSuccess("回款确认成功");
          this.openRtnMoney = false;
          this.getList();
        })
    },
    cancelRtnMoney() {
          this.openRtnMoney = false;
          //this.getList();
    }
  }
};
</script>
